Detecting user interface elements in robotic process automation using convolutional neural networks

ABSTRACT

Graphical elements in a user interface (UI) may be detected in robotic process automation (RPA) using convolutional neural networks (CNNs). Such processes may be particularly well-suited for detecting graphical elements that are too small to be detected using conventional techniques. The accuracy of detecting graphical elements (e.g., control objects) may be enhanced by providing neural network-based processing that is robust to changes in various UI factors, such as different resolutions, different operating system (OS) scaling factors, different dots-per-inch (DPI) settings, and changes due to UI customization of applications and websites, for example.

FIELD

The present invention generally relates to Robotic Process Automation(RPA), and more specifically, to detecting user interface (UI) elementsin RPA using convolutional neural networks (CNNs).

BACKGROUND

Robotic process automation (RPA) allows automation of the execution ofrepetitive and manually intensive activities. RPA can be used, forexample, to interact with software applications through a user interface(UI), similar to how a human being would interact with the application.Interactions with the UI were typically performed by an RPA applicationusing application programming interface (API) calls to a function thatreturns a set of coordinates (i.e., a “selector”). The RPA applicationcan then use this information to simulate a mouse click of a button, forexample, that causes the target application to act as if the user hadmanually clicked on the button.

Per the above, in a typical RPA implementation for native computingsystems, the selectors work using the underlying properties of thegraphical elements of the UI to identify graphical elements in theapplication (e.g., buttons, text fields, etc.). However, this techniquebreaks down when trying to automate the same software in VDEs, such asthose provided by Citrix®, VMWare®, VNC®, and Windows® (Windows® RemoteDesktop). The reason for the breakdown is that VDEs stream an image ofthe remote desktop in a similar manner to how video streaming servicesdo. There are simply no selectors to be identified in the images (i.e.,“frames”) of the video. The RPA application thus cannot make an API callto determine the location of a graphical element to be provided to theapplication, for example. Attempts have been made to solve thischallenge using optical character recognition (OCR) and image matchingfor VDE scenarios. However, these techniques have proven to beinsufficiently reliable and have caused maintenance issues since evenminor changes in the UI tend to break the automations.

Computer Vision™ (CV) by UiPath®, for example, solves this problem byusing a mix of artificial intelligence (AI), OCR, text fuzzy-matching,and an anchoring system. A CV model identifies the specific graphicalelements in the image. This provides more accurate identification ofgraphical elements, such as text fields, buttons, check boxes, icons,etc.

To recognize graphical elements, AI algorithms, such as FasterRegion-based Convolutional Neural Network (R-CNN), may be used. See, forexample, Shaoqing Ren et al., Faster R-CNN: Towards Real-Time ObjectDetection with Region Proposal Networks, arXiv:1506.01497v3 (submittedJun. 4, 2015). Faster R-CNN passes images of the target applicationinterface through a ResNet with dilated convolutions (also called atrousconvolutions) that output feature maps or tensors (i.e., a smaller imagewith 2048 channels). These feature maps are further passed throughanother neural network a region proposal network (RPN) that proposesthousands of possible rectangles where a graphical element of interestis believed to potentially have been found, as well as guesses withrespect to what regions are believed to be graphical elements as a listof coordinates. The feature maps are grids and there are proposals (alsocalled anchors) for each square on the grid. For each anchor, the RPNprovides a classification. Further, there is a graphical element matchscore between 0 and 1 and a regression part indicating how far an anchorwould need to be moved to match a particular graphical element. In otherwords, the RPN outputs regions where it thinks it found graphicalelements, as well as what these graphical elements are believed topotentially be and associated probabilities.

With these proposals, many crops are made from the feature tensorsoutput from the backbone ResNet. In these large feature tensors, featuredimensions are cropped. Cropped boxes are then passed again through afew layers of the CNN, which can output a more precise location andclass distribution. Such Faster R-CNN 100 for graphical elementdetection is shown in FIG. 1.

However, due to this repeated cropping, certain smaller graphicalelements may not have a representative pixel by the end of the process.For instance, passing a 2048×1024 input image through a ResNet backbonethat produces a feature map with 2048 channels with a standard stride of32 that reduces dimensionality by a factor of two each time, a 10×10checkbox, for example, would not have a representative pixel by the endof the ResNet process. Also, changes to resolutions, operating system(OS) scaling factors, dots-per-inch (DPI) settings, and changes due toUI customization of applications and websites, for example, aredifficult to accommodate using current techniques. Accordingly, animproved UI element detection approach may be beneficial.

SUMMARY

Certain embodiments of the present invention may provide solutions tothe problems and needs in the art that have not yet been fullyidentified, appreciated, or solved by current image analysis techniques.For example, some embodiments of the present invention pertain todetecting UI elements in RPA using CNNs. Some embodiments enhance theaccuracy of detecting graphical elements (e.g., control objects) byproviding neural network-based processing that is robust to changes invarious UI factors, such as different resolutions, different OS scalingfactors, different DPI settings, and changes due to UI customization ofapplications and websites, for example.

In an embodiment, a computer program is embodied on a non-transitorycomputer-readable medium, the program is configured to cause at leastone processor to create a raw dataset by collecting images directly froman environment on which a CNN will operate and augment the raw datasetto produce an augmented dataset. The program is also configured to causethe at least one processor to train the CNN using the augmented datasetand detecting graphical elements in a UI using the trained CNN.

In another embodiment, a computer-implemented method includesaugmenting, by a computing system, a raw dataset using channelrandomization, hue shift, color inversion, random cropping, randomscaling, blurring of images, or any combination thereof, to produce anaugmented dataset. The computer-implemented method also includestraining a CNN, by the computing system, using the augmented dataset.The computer-implemented method further includes detecting graphicalelements in a UI, by the computing system, using the trained CNN.

In yet another embodiment, a system includes memory storing computerprogram instructions and at least one processor configured to executethe computer program instructions. The at least one processor isconfigured to detect graphical elements in a UI using a Faster R-CNNnetwork. The detection includes overlaying rectangles over an image as agrid and providing a predetermined number of proposals for eachrectangle in the grid. The proposals include a scale and a stridedistance. The stride distance defines a distance between the rectangles.Each time two rectangles are compared, an intersection over a union oran intersection over a minimum is used with a given threshold. Thethreshold is an adaptive threshold that depends on an area of a givenrectangle.

BRIEF DESCRIPTION OF THE DRAWINGS

In order that the advantages of certain embodiments of the inventionwill be readily understood, a more particular description of theinvention briefly described above will be rendered by reference tospecific embodiments that are illustrated in the appended drawings.While it should be understood that these drawings depict only typicalembodiments of the invention and are not therefore to be considered tobe limiting of its scope, the invention will be described and explainedwith additional specificity and detail through the use of theaccompanying drawings, in which:

FIG. 1 illustrates an implementation of Faster R-CNN.

FIG. 2 is an architectural diagram illustrating an RPA system, accordingto an embodiment of the present invention.

FIG. 3 is an architectural diagram illustrating a deployed RPA system,according to an embodiment of the present invention.

FIG. 4 is an architectural diagram illustrating the relationship betweena designer, activities, and drivers, according to an embodiment of thepresent invention.

FIG. 5 is an architectural diagram illustrating an RPA system, accordingto an embodiment of the present invention.

FIG. 6 is an architectural diagram illustrating a computing systemconfigured to detect UI elements in an RPA system using CNNs, accordingto an embodiment of the present invention.

FIG. 7 is a flowchart illustrating a process for training a neuralnetwork, according to an embodiment of the present invention.

FIG. 8 is a flowchart illustrating a process for training a neuralnetwork, according to an embodiment of the present invention.

DETAILED DESCRIPTION OF THE EMBODIMENTS

Some embodiments pertain to detecting UI elements in RPA using CNNs.This process may be particularly well-suited for detecting graphicalelements that are too small to be detected using conventionaltechniques. For instance, in some UIs, checkboxes may vary in sizebetween 8×8 pixels and 32×32 pixels and edit boxes may vary between20×10 pixels and 3500×32 pixels, for example. However, graphicalelements of any size may be detected in some embodiments withoutdeviating from the scope of the invention. Indeed, some embodimentsenhance the accuracy of detecting graphical elements (e.g., controlobjects) by providing neural network-based processing that is robust tochanges in various UI factors, such as different resolutions (e.g.,800×600 to 3840×2160 and beyond), different OS scaling factors (e.g.,75% to 200%), different DPI settings, and changes due to UIcustomization of applications and websites, for example.

Per the above, in some embodiments, video images may come from a VDEserver, and may be of a visual display or a part thereof. Some exampleVMs include, but are not limited to, those provided by Citrix®, VMWare®,VNC®, Windows® Remote Desktop, etc. However, images may also come fromother sources, including, but not limited to, Flash, Silverlight, or PDFdocuments, image files of various formats (e.g., JPG, BMP, PNG, etc.),or any other suitable image source without deviating from the scope ofthe invention. Such images may include, but are not limited to, awindow, a document, a financial receipt, an invoice, etc.

FIG. 2 is an architectural diagram illustrating an RPA system 200,according to an embodiment of the present invention. RPA system 200includes a designer 210 that allows a developer to design and implementworkflows. Designer 210 may provide a solution for applicationintegration, as well as automating third-party applications,administrative Information Technology (IT) tasks, and business ITprocesses. Designer 210 may facilitate development of an automationproject, which is a graphical representation of a business process.Simply put, designer 210 facilitates the development and deployment ofworkflows and robots.

The automation project enables automation of rule-based processes bygiving the developer control of the execution order and the relationshipbetween a custom set of steps developed in a workflow, defined herein as“activities.” One commercial example of an embodiment of designer 210 isUiPath Studio™. Each activity may include an action, such as clicking abutton, reading a file, writing to a log panel, etc. In someembodiments, workflows may be nested or embedded.

Some types of workflows may include, but are not limited to, sequences,flowcharts, Finite State Machines (FSMs), and/or global exceptionhandlers. Sequences may be particularly suitable for linear processes,enabling flow from one activity to another without cluttering aworkflow. Flowcharts may be particularly suitable to more complexbusiness logic, enabling integration of decisions and connection ofactivities in a more diverse manner through multiple branching logicoperators. FSMs may be particularly suitable for large workflows. FSMsmay use a finite number of states in their execution, which aretriggered by a condition (i.e., transition) or an activity. Globalexception handlers may be particularly suitable for determining workflowbehavior when encountering an execution error and for debuggingprocesses.

Once a workflow is developed in designer 210, execution of businessprocesses is orchestrated by conductor 220, which orchestrates one ormore robots 230 that execute the workflows developed in designer 210.One commercial example of an embodiment of conductor 220 is UiPathOrchestrator™. Conductor 220 facilitates management of the creation,monitoring, and deployment of resources in an environment. Conductor 220may act as an integration point with third-party solutions andapplications.

Conductor 220 may manage a fleet of robots 230, connecting and executingrobots 230 from a centralized point. Types of robots 230 that may bemanaged include, but are not limited to, attended robots 232, unattendedrobots 234, development robots (similar to unattended robots 234, butused for development and testing purposes), and nonproduction robots(similar to attended robots 232, but used for development and testingpurposes). Attended robots 232 are triggered by user events and operatealongside a human on the same computing system. Attended robots 232 maybe used with conductor 220 for a centralized process deployment andlogging medium. Attended robots 232 may help the human user accomplishvarious tasks, and may be triggered by user events. In some embodiments,processes cannot be started from conductor 220 on this type of robotand/or they cannot run under a locked screen. In certain embodiments,attended robots 232 can only be started from a robot tray or from acommand prompt. Attended Robots 232 should run under human supervisionin some embodiments.

Unattended robots 234 run unattended in virtual environments and canautomate many processes. Unattended robots 234 may be responsible forremote execution, monitoring, scheduling, and providing support for workqueues. Debugging for all robot types may be run in designer 210 in someembodiments. Both attended and unattended robots may automate varioussystems and applications including, but not limited to, mainframes, webapplications, VMs, enterprise applications (e.g., those produced bySAP®, SalesForce®, Oracle®, etc.), and computing system applications(e.g., desktop and laptop applications, mobile device applications,wearable computer applications, etc.).

Conductor 220 may have various capabilities including, but not limitedto, provisioning, deployment, configuration, queueing, monitoring,logging, and/or providing interconnectivity. Provisioning may includecreating and maintenance of connections between robots 230 and conductor220 (e.g., a web application). Deployment may include assuring thecorrect delivery of package versions to assigned robots 230 forexecution. Configuration may include maintenance and delivery of robotenvironments and process configurations. Queueing may include providingmanagement of queues and queue items. Monitoring may include keepingtrack of robot identification data and maintaining user permissions.Logging may include storing and indexing logs to a database (e.g., anSQL database) and/or another storage mechanism (e.g., ElasticSearch®,which provides the ability to store and quickly query large datasets).Conductor 220 may provide interconnectivity by acting as the centralizedpoint of communication for third-party solutions and/or applications.

Robots 230 are execution agents that run workflows built in designer210. One commercial example of some embodiments of robot(s) 230 isUiPath Robots™. In some embodiments, robots 230 install the MicrosoftWindows® Service Control Manager (SCM)-managed service by default. As aresult, such robots 230 can open interactive Windows® sessions under thelocal system account, and have the rights of a Windows® service.

In some embodiments, robots 230 can be installed in a user mode. Forsuch robots 230, this means they have the same rights as the user underwhich a given robot 230 has been installed. This feature may also beavailable for High Density (HD) robots, which ensure full utilization ofeach machine at its maximum potential. In some embodiments, any type ofrobot 230 may be configured in an HD environment.

Robots 230 in some embodiments are split into several components, eachbeing dedicated to a particular automation task. The robot components insome embodiments include, but are not limited to, SCM-managed robotservices, user mode robot services, executors, agents, and command line.SCM-managed robot services manage and monitor Windows® sessions and actas a proxy between conductor 220 and the execution hosts (i.e., thecomputing systems on which robots 230 are executed). These services aretrusted with and manage the credentials for robots 230. A consoleapplication is launched by the SCM under the local system.

User mode robot services in some embodiments manage and monitor Windows®sessions and act as a proxy between conductor 220 and the executionhosts. User mode robot services may be trusted with and manage thecredentials for robots 230. A Windows® application may automatically belaunched if the SCM-managed robot service is not installed.

Executors may run given jobs under a Windows® session (i.e., they mayexecute workflows. Executors may be aware of per-monitor dots per inch(DPI) settings. Agents may be Windows® Presentation Foundation (WPF)applications that display the available jobs in the system tray window.Agents may be a client of the service. Agents may request to start orstop jobs and change settings. The command line is a client of theservice. The command line is a console application that can request tostart jobs and waits for their output.

Having components of robots 230 split as explained above helpsdevelopers, support users, and computing systems more easily run,identify, and track what each component is executing. Special behaviorsmay be configured per component this way, such as setting up differentfirewall rules for the executor and the service. The executor may alwaysbe aware of DPI settings per monitor in some embodiments. As a result,workflows may be executed at any DPI, regardless of the configuration ofthe computing system on which they were created. Projects from designer210 may also be independent of browser zoom level ins some embodiments.For applications that are DPI-unaware or intentionally marked asunaware, DPI may be disabled in some embodiments.

FIG. 3 is an architectural diagram illustrating a deployed RPA system300, according to an embodiment of the present invention. In someembodiments, RPA system 300 may be, or may be a part of, RPA system 200of FIG. 2. It should be noted that the client side, the server side, orboth, may include any desired number of computing systems withoutdeviating from the scope of the invention. On the client side, a robotapplication 310 includes executors 312, an agent 314, and a designer316. However, in some embodiments, designer 316 may not be running oncomputing system 310. Executors 312 are running processes. Severalbusiness projects may run simultaneously, as shown in FIG. 3. Agent 314(e.g., a Windows® service) is the single point of contact for allexecutors 312 in this embodiment. All messages in this embodiment arelogged into conductor 330, which processes them further via databaseserver 340, indexer server 350, or both. As discussed above with respectto FIG. 2, executors 312 may be robot components.

In some embodiments, a robot represents an association between a machinename and a username. The robot may manage multiple executors at the sametime. On computing systems that support multiple interactive sessionsrunning simultaneously (e.g., Windows® Server 2012), there multiplerobots may be running at the same time, each in a separate Windows®session using a unique username. This is referred to as HD robots above.

Agent 314 is also responsible for sending the status of the robot (e.g.,periodically sending a “heartbeat” message indicating that the robot isstill functioning) and downloading the required version of the packageto be executed. The communication between agent 314 and conductor 330 isalways initiated by agent 314 in some embodiments. In the notificationscenario, agent 314 may open a WebSocket channel that is later used byconductor 330 to send commands to the robot (e.g., start, stop, etc.).

On the server side, a presentation layer (web application 332, Open DataProtocol (OData) Representative State Transfer (REST) ApplicationProgramming Interface (API) endpoints 334, and notification andmonitoring 336), a service layer (API implementation/business logic338), and a persistence layer (database server 340 and indexer server350) are included. Conductor 330 includes web application 332, ODataREST API endpoints 334, notification and monitoring 336, and APIimplementation/business logic 338. In some embodiments, most actionsthat a user performs in the interface of conductor 320 (e.g., viabrowser 320) are performed by calling various APIs. Such actions mayinclude, but are not limited to, starting jobs on robots,adding/removing data in queues, scheduling jobs to run unattended, etc.without deviating from the scope of the invention. Web application 332is the visual layer of the server platform. In this embodiment, webapplication 332 uses Hypertext Markup Language (HTML) and JavaScript(JS). However, any desired markup languages, script languages, or anyother formats may be used without deviating from the scope of theinvention. The user interacts with web pages from web application 332via browser 320 in this embodiment in order to perform various actionsto control conductor 330. For instance, the user may create robotgroups, assign packages to the robots, analyze logs per robot and/or perprocess, start and stop robots, etc.

In addition to web application 332, conductor 330 also includes servicelayer that exposes OData REST API endpoints 334. However, otherendpoints may be included without deviating from the scope of theinvention. The REST API is consumed by both web application 332 andagent 314. Agent 314 is the supervisor of one or more robots on theclient computer in this embodiment.

The REST API in this embodiment covers configuration, logging,monitoring, and queueing functionality. The configuration endpoints maybe used to define and configure application users, permissions, robots,assets, releases, and environments in some embodiments. Logging RESTendpoints may be used to log different information, such as errors,explicit messages sent by the robots, and other environment-specificinformation, for instance. Deployment REST endpoints may be used by therobots to query the package version that should be executed if the startjob command is used in conductor 330. Queueing REST endpoints may beresponsible for queues and queue item management, such as adding data toa queue, obtaining a transaction from the queue, setting the status of atransaction, etc.

Monitoring rest endpoints monitor web application 332 and agent 314.Notification and monitoring API 336 may be REST endpoints that are usedfor registering agent 314, delivering configuration settings to agent314, and for sending/receiving notifications from the server and agent314. Notification and monitoring API 336 may also use WebSocketcommunication in some embodiments.

The persistence layer includes a pair of servers in thisembodiment—database server 340 (e.g., a SQL server) and indexer server350. Database server 340 in this embodiment stores the configurations ofthe robots, robot groups, associated processes, users, roles, schedules,etc. This information is managed through web application 332 in someembodiments. Database server 340 may manages queues and queue items. Insome embodiments, database server 340 may store messages logged by therobots (in addition to or in lieu of indexer server 350).

Indexer server 350, which is optional in some embodiments, stores andindexes the information logged by the robots. In certain embodiments,indexer server 350 may be disabled through configuration settings. Insome embodiments, indexer server 350 uses ElasticSearch®, which is anopen source project full-text search engine. Messages logged by robots(e.g., using activities like log message or write line) may be sentthrough the logging REST endpoint(s) to indexer server 350, where theyare indexed for future utilization.

FIG. 4 is an architectural diagram illustrating the relationship 400between a designer 410, activities 420, 430, and drivers 440, accordingto an embodiment of the present invention. Per the above, a developeruses designer 410 to develop workflows that are executed by robots.Workflows may include user-defined activities 420 and UI automationactivities 430. Some CV activities may include, but are not limited to,click, type, get text, hover, element exists, refresh scope, highlight,etc. Click in some embodiments identifies an element using CV, OCR,fuzzy text matching, and multi-anchor, for example, and clicks it. Typemay identify an element using the above and types in the element. Gettext may identify the location of specific text and scan it using OCR.Hover may identify an element and hover over it. Element exists maycheck whether an element exists on the screen using the techniquesdescribed above. In some embodiments, there may be hundreds or eventhousands of activities that can be implemented in designer 410.However, any number and/or type of activities may be available withoutdeviating from the scope of the invention.

UI automation activities 430 are a subset of special, lower levelactivities that are written in lower level code (e.g., CV activities)and facilitate interactions with the screen. UI automation activities430 facilitate these interactions via drivers 440 that allow the robotto interact with the desired software. For instance, drivers 440 mayinclude OS drivers 442, browser drivers 444, VM drivers 446, enterpriseapplication drivers 448, etc.

Drivers 440 may interact with the OS at a low level looking for hooks,monitoring for keys, etc. They may facilitate integration with Chrome®,IE®, Citrix®, SAP®, etc. For instance, the “click” activity performs thesame role in these different applications via drivers 440.

FIG. 5 is an architectural diagram illustrating an RPA system 500,according to an embodiment of the present invention. In someembodiments, RPA system 500 may be or include RPA systems 200 and/or 300of FIGS. 2 and/or 3. RPA system 500 includes multiple client computingsystems 510 running robots. Computing systems 510 are able tocommunicate with a conductor computing system 520 via a web applicationrunning thereon. Conductor computing system 520, in turn, is able tocommunicate with a database server 530 and an optional indexer server540.

With respect to FIGS. 3 and 5, it should be noted that while a webapplication is used in these embodiments, any suitable client/serversoftware may be used without deviating from the scope of the invention.For instance, the conductor may run a server-side application thatcommunicates with non-web-based client software applications on theclient computing systems.

FIG. 6 is an architectural diagram illustrating a computing system 600configured to detect UI elements in an RPA system using CNNs, accordingto an embodiment of the present invention. In some embodiments,computing system 600 may be one or more of the computing systemsdepicted and/or described herein. Computing system 600 includes a bus605 or other communication mechanism for communicating information, andprocessor(s) 610 coupled to bus 605 for processing information.Processor(s) 610 may be any type of general or specific purposeprocessor, including a Central Processing Unit (CPU), an ApplicationSpecific Integrated Circuit (ASIC), a Field Programmable Gate Array(FPGA), a Graphics Processing Unit (GPU), multiple instances thereof,and/or any combination thereof. Processor(s) 610 may also have multipleprocessing cores, and at least some of the cores may be configured toperform specific functions. Multi-parallel processing may be used insome embodiments. In certain embodiments, at least one of processor(s)610 may be a neuromorphic circuit that includes processing elements thatmimic biological neurons. In some embodiments, neuromorphic circuits maynot require the typical components of a Von Neumann computingarchitecture.

Computing system 600 further includes a memory 615 for storinginformation and instructions to be executed by processor(s) 610. Memory615 can be comprised of any combination of Random Access Memory (RAM),Read Only Memory (ROM), flash memory, cache, static storage such as amagnetic or optical disk, or any other types of non-transitorycomputer-readable media or combinations thereof. Non-transitorycomputer-readable media may be any available media that can be accessedby processor(s) 610 and may include volatile media, non-volatile media,or both. The media may also be removable, non-removable, or both.

Additionally, computing system 600 includes a communication device 620,such as a transceiver, to provide access to a communications network viaa wireless and/or wired connection. In some embodiments, communicationdevice 620 may be configured to use Frequency Division Multiple Access(FDMA), Single Carrier FDMA (SC-FDMA), Time Division Multiple Access(TDMA), Code Division Multiple Access (CDMA), Orthogonal FrequencyDivision Multiplexing (OFDM), Orthogonal Frequency Division MultipleAccess (OFDMA), Global System for Mobile (GSM) communications, GeneralPacket Radio Service (GPRS), Universal Mobile Telecommunications System(UMTS), cdma2000, Wideband CDMA (W-CDMA), High-Speed Downlink PacketAccess (HSDPA), High-Speed Uplink Packet Access (HSUPA), High-SpeedPacket Access (HSPA), Long Term Evolution (LTE), LTE Advanced (LTE-A),802.11x, Wi-Fi, Zigbee, Ultra-WideBand (UWB), 802.16x, 802.15, HomeNode-B (HnB), Bluetooth, Radio Frequency Identification (RFID), InfraredData Association (IrDA), Near-Field Communications (NFC), fifthgeneration (5G), New Radio (NR), any combination thereof, and/or anyother currently existing or future-implemented communications standardand/or protocol without deviating from the scope of the invention. Insome embodiments, communication device 620 may include one or moreantennas that are singular, arrayed, phased, switched, beamforming,beamsteering, a combination thereof, and or any other antennaconfiguration without deviating from the scope of the invention.

Processor(s) 610 are further coupled via bus 605 to a display 625, suchas a plasma display, a Liquid Crystal Display (LCD), a Light EmittingDiode (LED) display, a Field Emission Display (FED), an Organic LightEmitting Diode (OLED) display, a flexible OLED display, a flexiblesubstrate display, a projection display, a 4K display, a high definitiondisplay, a Retina® display, an In-Plane Switching (IPS) display, or anyother suitable display for displaying information to a user. Display 625may be configured as a touch (haptic) display, a three dimensional (3D)touch display, a multi-input touch display, a multi-touch display, etc.using resistive, capacitive, surface-acoustic wave (SAW) capacitive,infrared, optical imaging, dispersive signal technology, acoustic pulserecognition, frustrated total internal reflection, etc. Any suitabledisplay device and haptic I/O may be used without deviating from thescope of the invention.

A keyboard 630 and a cursor control device 635, such as a computermouse, a touchpad, etc., are further coupled to bus 605 to enable a userto interface with computing system. However, in certain embodiments, aphysical keyboard and mouse may not be present, and the user mayinteract with the device solely through display 625 and/or a touchpad(not shown). Any type and combination of input devices may be used as amatter of design choice. In certain embodiments, no physical inputdevice and/or display is present. For instance, the user may interactwith computing system 600 remotely via another computing system incommunication therewith, or computing system 600 may operateautonomously.

Memory 615 stores software modules that provide functionality whenexecuted by processor(s) 610. The modules include an operating system640 for computing system 600. The modules further include a graphicalelement detection module 645 that is configured to perform all or partof the processes described herein or derivatives thereof. Computingsystem 600 may include one or more additional functional modules 650that include additional functionality.

One skilled in the art will appreciate that a “system” could be embodiedas a server, an embedded computing system, a personal computer, aconsole, a personal digital assistant (PDA), a cell phone, a tabletcomputing device, a quantum computing system, or any other suitablecomputing device, or combination of devices without deviating from thescope of the invention. Presenting the above-described functions asbeing performed by a “system” is not intended to limit the scope of thepresent invention in any way, but is intended to provide one example ofthe many embodiments of the present invention. Indeed, methods, systems,and apparatuses disclosed herein may be implemented in localized anddistributed forms consistent with computing technology, including cloudcomputing systems.

It should be noted that some of the system features described in thisspecification have been presented as modules, in order to moreparticularly emphasize their implementation independence. For example, amodule may be implemented as a hardware circuit comprising custom verylarge scale integration (VLSI) circuits or gate arrays, off-the-shelfsemiconductors such as logic chips, transistors, or other discretecomponents. A module may also be implemented in programmable hardwaredevices such as field programmable gate arrays, programmable arraylogic, programmable logic devices, graphics processing units, or thelike.

A module may also be at least partially implemented in software forexecution by various types of processors. An identified unit ofexecutable code may, for instance, include one or more physical orlogical blocks of computer instructions that may, for instance, beorganized as an object, procedure, or function. Nevertheless, theexecutables of an identified module need not be physically locatedtogether, but may include disparate instructions stored in differentlocations that, when joined logically together, comprise the module andachieve the stated purpose for the module. Further, modules may bestored on a computer-readable medium, which may be, for instance, a harddisk drive, flash device, RAM, tape, and/or any other suchnon-transitory computer-readable medium used to store data withoutdeviating from the scope of the invention.

Indeed, a module of executable code could be a single instruction, ormany instructions, and may even be distributed over several differentcode segments, among different programs, and across several memorydevices. Similarly, operational data may be identified and illustratedherein within modules, and may be embodied in any suitable form andorganized within any suitable type of data structure. The operationaldata may be collected as a single data set, or may be distributed overdifferent locations including over different storage devices, and mayexist, at least partially, merely as electronic signals on a system ornetwork.

FIG. 7 is a flowchart illustrating a process 700 for training a neuralnetwork, according to an embodiment of the present invention. Theprocess begins with framing a problem as a graphical element detectionproblem at 710. Next, a raw dataset is created at 720. The raw datasetis created in some embodiments by collecting images (i.e., screenshotsof different application user interfaces) directly from the environmenton which the CNN will operate. In some embodiments, the raw datasetincludes screenshots from widely varying applications in an attempt tomake the trained algorithm more robust. The raw dataset may also becreated from synthetic data that provides images that are similar tothose from real screenshots.

Synthetic data may be created in some embodiments by a program thatgenerates other programs. The interfaces of the generated programs maythen be scraped to obtain “screenshots.” In some embodiments, theinterfaces may look similar to desired software applications, such asenterprise resource planning (ERP) systems.

The raw dataset is then augmented at 730, creating an augmented dataset.The augmented dataset is created from the raw dataset in order to createadditional datapoints in addition to the raw datapoints to train theneural network, and may include the raw dataset as well. As anonlimiting example for visualization purposes, consider the scenario ofcollecting five images of a cat as raw data. Augmented data may becreated by modifying the cat images in various ways that include, butare not limited to, flipping images horizontally, changing colors,artificially adding noise, artificially adding lighting, or anycombination thereof. This helps to simulate scenarios that may happen inthe real world. As such, the augmented dataset provides more datapointsfor the neural network, making it more robust to real world scenarios,once trained.

In some embodiments, the dataset is augmented using channelrandomization, hue shift, color inversion, random cropping, randomscaling, blurring of images, or any combination thereof. Channelrandomization makes the CNN robust to different color schemes. Channelrandomization involves changing channel order (e.g., converting red intoblue), resulting in new images and helping the network to understandcolors. Hue shift and color inversion also make the network more robustto different color schemes. The latter may be especially beneficialsince most UIs have white or dark themes.

Random cropping helps to achieve the translation effect due to theanchor stride and network convolutions strides. This assists in solvingthe intrinsic problem of strides in the architecture. Random croppingmay be performed by overlaying a substantial number of rectangles (e.g.,dozens of rectangles), which are usually laid out as a grid and thenmatched with actual labels. If a match occurs, the cropped image istaken as a positive example to train the network. If, however, the matchdoes not occur, the cropped image is used as negative example to trainthe network.

The anchors have a granularity (scale) and a stride distance between theboxes. Thus, if there is a check box between two text boxes, forexample, the algorithm in some embodiments will not miss it. Theproposed network can be made to be sensitive to even small translations(e.g., a four pixel translation).

In some implementations, different cropping techniques may be used fordifferent controls. For example, to identify a graphical element that isan image, it may be cropped at the bottom. Similarly, tables may beadjusted by size and other general text may be cropped in the middle insome embodiments. Using different cropping techniques may yield betterresults in some embodiments, but this may not be known beforehand.

Random scaling may allow coverage of a wider part of the real-lifedistribution of different systems and applications. For example, abutton rendered in 800×600 resolutions may have 16×16 pixels. However,when the same button is rendered in a 4k monitor, number of pixels inthe button area will be considerably higher. The neural network may betrained for different scales using this approach. Blurring of images mayalso be used to make the network more robust to different compressionand resize blurs that can occur in actual implementations.

After the augmented dataset is produced, a Faster R-CNN architecturedesigned for graphical element detection is used to detect graphicalelements at 740. In some embodiments, the Faster R-CNN architecture ismodified to be suitable for detecting small UI graphical elements and/orimproving graphical element detection accuracy by making the algorithmmore robust to changes in the UI. For example, image resizing may bebypassed. Conventional Faster R-CNN resizes to a fixed shape, but someembodiments do not do this. Atrous convolutions may be used to assist infinding larger UI elements and to take more context into account. Also,variable proposal sizes may be used. For example, it is typicallyexpected to find more graphical elements in a larger screenshot than ina smaller one.

Faster R-CNN was found to be the most effective architecture duringcomparative testing with other architectures. However, any othersuitable architecture, such as SSD, RetinaNet, YOLO, etc., may bemodified without deviating from the scope of the invention. Also, whilethe RPN backbone of some embodiments is ResNet-101, having the fastestperformance and best wmAP during testing, any desired RPN backbone maybe used without deviating from the scope of the invention.

The Faster R-CNN implementation of some embodiments may be theTensorflow object detection API. In such embodiments, the momentumoptimizer with a learning rate that roughly follows an exponential decayrule may be used. Due to the range of the object sizes, we made thefollowing decisions were made with respect to a practicalimplementation. It was decided to use a dilated convolution in theResNet-101 backbone to increase the receptive field without incurring amodel size penalty. For this, first_stage_atrous_rate was set to 2. Thefollowing anchor settings were also used: (1) a base size of width=64and height=64; (2) a stride with width=8 and height=8; (3) scales of0.25, 0.5, 1.0, and 2.0; and (4) aspect ratios of 0.5, 1.0, and 2.0. Thenumber of proposals of both stages was set to 400. Proposals are ahyper-parameter for two stage detection networks.

The CNN architecture is only inherently invariant to translation if allof the strides are equal to 1. Otherwise, differences start to appear.Additionally, due to the stride of the anchors, even greater problemsemerge with respect to translation. Thus, the dataset should beaugmented to include translations.

In some embodiments, each time two boxes are compared, the intersectionover the union or the intersection over the minimum is used with a giventhreshold. An adaptive threshold may be used in some embodiments thatdepends on the area of the box. For small graphical elements, a smallthreshold works well. However, for larger graphical elements, a largerthreshold may be preferable.

Each prediction in some embodiments comes with a “confidence” that thenetwork has with respect to that prediction. The threshold may be theminimum confidence take that prediction into account. For instance, ifthe minimum confidence is 70%, only predictions with at least thatconfidence value would be used in some embodiments. In certainembodiments, the confidence is computed dynamically as a function ofprecision/recall.

The model in some embodiments provides a fixed number of detectedcontrols. Based on a precision/recall tradeoff, these proposals may befiltered with different thresholds for design time (i.e., when adeveloper is defining the automation) and at runtime (i.e., when therobot runs the automation on its own). At design time, a threshold maybe used that maximizes precision (i.e., only graphical elements areshown that are believed to be accurately identified with a high degreeof certainty). For example, a confidence of above 90% may be required insome embodiments as the high degree of certainly. However, any desiredhigher confidence may be used without deviating from the scope of theinvention. In this manner, the chances that the graphical elements arefound at runtime are high.

At runtime, however, a lower threshold may be used that maximizesrecall. Thus, a larger number of potential graphical elements may beidentified. Multi-anchor post-processing, such as that described in U.S.patent application Ser. Nos. 16/517,225, may then be used to helpidentify the desired controls even with low precision (high noise)detections.

Some embodiments realize various advantages over existing imagerecognition techniques. For instance, some embodiments provide moreaccurate recall (i.e., fewer UI elements are missed or misidentified).Some embodiments are more robust to UI theme changes and UI scaling.Certain embodiments can be incrementally improved by adding more data,as well as by adding architecture changes (e.g., changing the internalmechanics of the neural network, but still having the sameinput/output).

FIG. 8 is a flowchart illustrating a process 800 for training a neuralnetwork, according to an embodiment of the present invention. Theprocess beings with creating a raw dataset by collecting images directlyfrom an environment on which a CNN will operate at 810. In someembodiments, the raw dataset is created from synthetic data mimickingreal screenshots.

Next, the raw dataset is augmented to produce an augmented dataset at820. In some embodiments, the augmenting of the raw dataset includesflipping images horizontally, changing colors, artificially addingnoise, artificially adding lighting, or any combination thereof. Incertain embodiments, the augmenting of the raw data comprises usingchannel randomization, hue shift, color inversion, random cropping,random scaling, blurring of images, or any combination thereof. In someembodiments, the augmented dataset includes translations.

In embodiments where random cropping is used to produce cropped images,the augmenting of the raw dataset may include overlaying rectangles overthe cropped image as a grid, matching the overlaid rectangles to actuallabels, using the cropped image as a positive example to train the CNNwhen a match occurs, and using the cropped image as a negative exampleto train the CNN when a match does not occur. In certain embodiments,proposals are provided for each rectangle in the grid. The proposalsinclude a scale and a stride distance, the stride distance defining adistance between the rectangles. In some embodiments, each time tworectangles are compared, an intersection over a union or an intersectionover a minimum is used with a given threshold. In certain embodiments,the threshold is an adaptive threshold that depends on an area of agiven rectangle. In some embodiments, different cropping techniques areused to identify at least two different graphical element types.

The CNN is then trained using the augmented dataset at 830. In someembodiments, the CNN includes a Faster R-CNN architecture. In certainembodiments, dilated convolution is used in the RPN backbone with twostages, different scales are used, and different aspect ratios are used.

Graphical elements are then detected in a UI using the trained CNN at840. In some embodiments, the detecting of the graphical elementsincludes providing a fixed number of proposals for each graphicalelement. In certain embodiments, the proposals are filtered withdifferent thresholds for design time and for runtime, the runtimethreshold requiring a higher detection probability than the design timethreshold.

The process steps performed in FIGS. 7 and 8 may be performed by acomputer program, encoding instructions for the processor(s) to performat least part of the process described in FIGS. 7 and 8, in accordancewith embodiments of the present invention. The computer program may beembodied on a non-transitory computer-readable medium. Thecomputer-readable medium may be, but is not limited to, a hard diskdrive, a flash device, RAM, a tape, and/or any other such medium orcombination of media used to store data. The computer program mayinclude encoded instructions for controlling processor(s) of a computingsystem (e.g., processor(s) 610 of computing system 600 of FIG. 6) toimplement all or part of the process steps described in FIGS. 7 and 8,which may also be stored on the computer-readable medium.

The computer program can be implemented in hardware, software, or ahybrid implementation. The computer program can be composed of modulesthat are in operative communication with one another, and which aredesigned to pass information or instructions to display. The computerprogram can be configured to operate on a general purpose computer, anASIC, or any other suitable device.

It will be readily understood that the components of various embodimentsof the present invention, as generally described and illustrated in thefigures herein, may be arranged and designed in a wide variety ofdifferent configurations. Thus, the detailed description of theembodiments of the present invention, as represented in the attachedfigures, is not intended to limit the scope of the invention as claimed,but is merely representative of selected embodiments of the invention.

The features, structures, or characteristics of the invention describedthroughout this specification may be combined in any suitable manner inone or more embodiments. For example, reference throughout thisspecification to “certain embodiments,” “some embodiments,” or similarlanguage means that a particular feature, structure, or characteristicdescribed in connection with the embodiment is included in at least oneembodiment of the present invention. Thus, appearances of the phrases“in certain embodiments,” “in some embodiment,” “in other embodiments,”or similar language throughout this specification do not necessarily allrefer to the same group of embodiments and the described features,structures, or characteristics may be combined in any suitable manner inone or more embodiments.

It should be noted that reference throughout this specification tofeatures, advantages, or similar language does not imply that all of thefeatures and advantages that may be realized with the present inventionshould be or are in any single embodiment of the invention. Rather,language referring to the features and advantages is understood to meanthat a specific feature, advantage, or characteristic described inconnection with an embodiment is included in at least one embodiment ofthe present invention. Thus, discussion of the features and advantages,and similar language, throughout this specification may, but do notnecessarily, refer to the same embodiment.

Furthermore, the described features, advantages, and characteristics ofthe invention may be combined in any suitable manner in one or moreembodiments. One skilled in the relevant art will recognize that theinvention can be practiced without one or more of the specific featuresor advantages of a particular embodiment. In other instances, additionalfeatures and advantages may be recognized in certain embodiments thatmay not be present in all embodiments of the invention.

One having ordinary skill in the art will readily understand that theinvention as discussed above may be practiced with steps in a differentorder, and/or with hardware elements in configurations which aredifferent than those which are disclosed. Therefore, although theinvention has been described based upon these preferred embodiments, itwould be apparent to those of skill in the art that certainmodifications, variations, and alternative constructions would beapparent, while remaining within the spirit and scope of the invention.In order to determine the metes and bounds of the invention, therefore,reference should be made to the appended claims.

1. A computer program embodied on a non-transitory computer-readablemedium, the program configured to cause at least one processor to:create a raw dataset by collecting images directly from an environmenton which a convolutional neural network (CNN) will operate; augment theraw dataset using random cropping to produce an augmented datasetcomprising cropped images; overlay rectangles over a cropped image ofthe produced cropped images as a grid; match the overlaid rectangles toactual labels; when a match occurs, use the cropped image as a positiveexample to train the CNN; when a match does not occur, use the croppedimage as a negative example to train the CNN; train the CNN using theaugmented dataset; and detect graphical elements in a user interface(UI) using the trained CNN.
 2. The computer program of claim 1, whereinthe raw dataset is created from synthetic data mimicking realscreenshots.
 3. The computer program of claim 1, wherein the augmentingof the raw dataset comprises flipping images horizontally, changingcolors, artificially adding noise, artificially adding lighting, or anycombination thereof.
 4. The computer program of claim 1, wherein theaugmenting of the raw data further comprises using channelrandomization, hue shift, color inversion, random scaling, blurring ofimages, or any combination thereof.
 5. (canceled)
 6. The computerprogram of claim 1, wherein the program is further configured to causethe at least one processor to: provide proposals for each rectangle inthe grid, wherein the proposals comprise a scale and a stride distance,the stride distance defining a distance between the rectangles, whereineach time two rectangles are compared, an intersection over a union oran intersection over a minimum is used with a given adaptive thresholdthat depends on an area of a given rectangle.
 7. The computer program ofclaim 1, wherein different cropping techniques are used to identify atleast two different graphical element types.
 8. The computer program ofclaim 1, wherein the CNN comprises a Faster Region-based ConvolutionalNeural Network (R-CNN) architecture with a region proposal network(RPN).
 9. The computer program of claim 1, wherein the augmented datasetcomprises translations.
 10. The computer program of claim 1, wherein thedetecting of the graphical elements comprises providing a fixed numberof proposals for each graphical element, and the proposals are filteredwith different thresholds for design time and for runtime, the runtimethreshold having a higher detection probability than the design timethreshold.
 11. A computer-implemented method, comprising: augmenting, bya computing system, a raw dataset using random cropping to produce anaugmented dataset comprising cropped images; overlaying rectangles overa cropped image of the produced cropped images as a grid, by thecomputing system; matching the overlaid rectangles to actual labels, bythe computing system; providing proposals for each rectangle in thegrid, by the computing system; when a match occurs, using the croppedimage as a positive example to train the CNN, by the computing system;when a match does not occur, using the cropped image as a negativeexample to train the CNN, by the computing system training aconvolutional neural network (CNN), by the computing system, using theaugmented dataset; and detecting graphical elements in a user interface(UI), by the computing system, using the trained CNN.
 12. Thecomputer-implemented method of claim 11, wherein the augmenting of theraw data further comprises using channel randomization, hue shift, colorinversion, random scaling, blurring of images, or any combinationthereof.
 13. The computer-implemented method of claim 11, whereindifferent cropping techniques are used to identify at least twodifferent graphical element types.
 14. The computer-implemented methodof claim 11, wherein each time two rectangles are compared, anintersection over a union or an intersection over a minimum is used witha given threshold, and the threshold is an adaptive threshold thatdepends on an area of a given rectangle.
 15. The computer-implementedmethod of claim 11, further comprising: creating the raw dataset, by thecomputing system, by collecting images directly from an environment onwhich the CNN will operate, wherein the raw dataset is created fromsynthetic data mimicking real screenshots, and the augmenting of the rawdataset comprises flipping images horizontally, changing colors,artificially adding noise, artificially adding lighting, or anycombination thereof.
 16. The computer-implemented method of claim 11,wherein the detecting of the graphical elements comprises providing afixed number of proposals for each graphical element, and the proposalsare filtered with different thresholds for design time and for runtime,the runtime threshold having a higher detection probability than thedesign time threshold.
 17. A system, comprising: memory storing computerprogram instructions; and at least one processor configured to executethe computer program instructions, the at least one processor configuredto: detect graphical elements in a user interface (UI) using a FasterRegion-based Convolutional Neural Network (R-CNN) architecture with aregion proposal network (RPN) backbone, the detection comprisingoverlaying rectangles over an image as a grid and providing apredetermined number of proposals for each rectangle in the grid,wherein the proposals comprise a scale and a stride distance, the stridedistance defining a distance between the rectangles, each time tworectangles are compared, an intersection over a union or an intersectionover a minimum is used with a given threshold, and the threshold is anadaptive threshold that depends on an area of a given rectangle.
 18. Thesystem of claim 17, wherein the proposals are filtered with differentthresholds for design time and for runtime, the runtime threshold havinga higher detection probability than the design time threshold.
 19. Thesystem of claim 17, wherein the at least one processor is furtherconfigured to: create a raw dataset by collecting images directly froman environment on which the Faster R-CNN will operate; and augment theraw dataset to produce an augmented dataset, wherein the raw dataset iscreated from synthetic data mimicking real screenshots, and theaugmenting of the raw dataset comprises flipping images horizontally,changing colors, artificially adding noise, artificially addinglighting, or any combination thereof.
 20. The system of claim 19,wherein the augmenting of the raw data comprises using channelrandomization, hue shift, color inversion, random cropping, randomscaling, blurring of images, or any combination thereof, and randomcropping is used to produce cropped images and the at least oneprocessor is further configured to: overlay rectangles over a croppedimage of the produced cropped images as a grid; match the overlaidrectangles to actual labels; when a match occurs, use the cropped imageas a positive example to train the CNN; and when a match does not occur,use the cropped image as a negative example to train the CNN.